package ch.uzh.ifi.seal.ssqa.ui.views;


import java.awt.Frame;

import javax.swing.JApplet;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

import ch.uzh.ifi.seal.ssqa.model.Diagram;
import ch.uzh.ifi.seal.ssqa.model.DiagramComponent;

public class ElementMetricsView extends ViewPart{
	
	public static final String ID = "ch.uzh.ifi.seal.ssqa.ui.views.ElementMetricsView";
	
	JApplet content; 
	EObject object = null;
	
	@Override
	public void createPartControl(Composite comp) {
		comp.setBackground( new Color(comp.getDisplay(), new RGB(255, 255,255)));
		Composite embeddedComposite = new Composite(comp, SWT.EMBEDDED);
		embeddedComposite.setBackground( new Color(comp.getDisplay(), new RGB(255, 255,255)));
		Frame frame = SWT_AWT.new_Frame(embeddedComposite);
		frame.setBackground(java.awt.Color.WHITE);
		this.content = new JApplet();
		this.content.setBackground(java.awt.Color.WHITE);
		frame.add(this.content);
	}

	public void openElementMetricsView(DiagramComponent component){
		    DiagramComponentMetrics diagramComponent = new DiagramComponentMetrics();
		    diagramComponent.generatePanelContent(component);	
			this.content.add(diagramComponent);
	}
	
	public void openElementMetricsView(Diagram diagram){
		
		
	}
	
	@Override
	public void setFocus() {}
}
